<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/WEB-INF/templates/cadProfis.xhtml">
    <ui:param name="pPageTitle" value="Passo 4 de 5 | Vinculos" />
    <ui:define name="formulario">
        
        <p:toolbar>
            <p:toolbarGroup align="right">
                <p:commandButton action="#{vinculoView.seguinte}" ajax="false"
                                 value="Próximo" icon="ui-icon-arrowthick-1-e" />
            </p:toolbarGroup>
            <p:toolbarGroup align="left">
                <p:commandButton action="#{vinculoView.voltar}" ajax="false"
                                 value="Voltar" icon="ui-icon-arrowthick-1-w" />
            </p:toolbarGroup>
        </p:toolbar>
        <p:spacer width="20px"/>

        <h:panelGrid columns="2" cellpadding="2" columnClasses="textAlignRight,textAlignLeft">  
            <p:outputLabel for="tipV" value="${label['profis.tip']}" />
            <p:selectOneRadio id="tipV" value="#{vinculoView.vinculo.tipo}" label="${label['profis.tip']}">
                <f:selectItems value="#{vinculoView.tipVinculo}"/>
            </p:selectOneRadio>          

            <p:outputLabel for="esf" value="${label['profis.esf']}" />
            <p:selectOneRadio id="esf" value="#{vinculoView.vinculo.esfera}" label="${label['profis.esf']}">
                <f:selectItems value="#{vinculoView.esfera}"/>
            </p:selectOneRadio>

            <p:outputLabel for="carH" value="${label['profis.carHo']}"/>
            <p:inputMask id="carH" value="#{vinculoView.vinculo.cargaHoraria}" 
                         label="${label['profis.carHo']}" mask="?99" size="10"/>

            <p:outputLabel for="horario" value="${label['profis.hSai']}" />
            <p:panel id="horario" header="${label['profis.hS']}">

                <h:panelGrid columns="7" columnClasses="textAlignCenter,textAlignCenter,textAlignCenter,
                             textAlignCenter,textAlignCenter,textAlignCenter,textAlignCenter">
                    <p:outputLabel value="Dom"/>
                    <p:outputLabel value="Seg"/>
                    <p:outputLabel value="Ter"/>
                    <p:outputLabel value="Qua"/>
                    <p:outputLabel value="Qui"/>
                    <p:outputLabel value="Sex"/>
                    <p:outputLabel value="Sab"/>

                    <p:inputMask value="#{vinculoView.vinculo.dom}" mask="99:00 às 99:00" size="10"/>
                    <p:inputMask value="#{vinculoView.vinculo.seg}" mask="99:00 às 99:00" size="10"/>
                    <p:inputMask value="#{vinculoView.vinculo.ter}" mask="99:00 às 99:00" size="10"/>
                    <p:inputMask value="#{vinculoView.vinculo.qua}" mask="99:00 às 99:00" size="10"/>
                    <p:inputMask value="#{vinculoView.vinculo.qui}" mask="99:00 às 99:00" size="10"/>
                    <p:inputMask value="#{vinculoView.vinculo.sex}" mask="99:00 às 99:00" size="10"/>
                    <p:inputMask value="#{vinculoView.vinculo.sab}" mask="99:00 às 99:00" size="10"/>
                </h:panelGrid>
            </p:panel>

            <p:outputLabel for="unidade" value="${label['profis.unidade']}" />
            <p:selectOneMenu id="unidade" value="#{vinculoView.vinculo.unidade}" 
                             label="${label['profis.unidade']}" 
                             filter="true" filterMatchMode="contains"
                             converter="#{unidadeConverter}" rendered="true">
                <f:selectItem itemLabel="Selecione uma opção" noSelectionOption="true"/>
                <f:selectItems value="#{unidadeView.unidades}" var="unidade" 
                               itemValue="#{unidade}" 
                               itemLabel="#{unidade.nomUnid}" />
            </p:selectOneMenu>

            <h:outputText value=""/>
            <p:commandButton update="tbVinc" action="#{vinculoView.actionSalvar}" 
                             value="${label['btnSalvar.label']}" icon="ui-icon-arrowthick-1-s" />
        </h:panelGrid>
        
        <p:dataTable id="tbVinc" var="vin" editable="true" editMode="cell" value="#{vinculoView.vinculos}" emptyMessage="Não existem vinculos" paginator="true"  rowsPerPageTemplate="5,10,15"
                     paginatorPosition="bottom" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">  
            <p:column headerText="${label['profis.tip']}">  
                <p:outputLabel value="#{vin.tipo}"/>  
            </p:column>  
            <p:column headerText="${label['profis.esf']}">  
                <p:outputLabel value="#{vin.esfera}"/>  
            </p:column>  
            <p:column headerText="${label['profis.carHo']}">  
                <p:outputLabel value="#{vin.cargaHoraria}"/>  
            </p:column>   
            <p:column headerText="${label['profis.unidade']}">  
                <p:outputLabel value="#{vin.unidade.nomUnid}" />  
            </p:column>  
        </p:dataTable> 
        
        <p:spacer width="20px"/>
        <h:outputText value="Os campos com ( * ) são de preenchimento obrigatório" style="color: red"/>
    </ui:define>
</ui:composition>